{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Sketcher.ipynb",
      "version": "0.3.2",
      "views": {},
      "default_view": {},
      "provenance": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "metadata": {
        "id": "6H3ATAdp_URp",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Get the Class names "
      ]
    },
    {
      "metadata": {
        "id": "zlx6-LFL_jbi",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "This file contains a subset of the quick draw classes. I choose around 100 classes from the dataset. "
      ]
    },
    {
      "metadata": {
        "id": "XXv-xzU1sd88",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 208
        },
        "outputId": "996326ae-e199-454b-9a62-897be2775746",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1530644111106,
          "user_tz": -180,
          "elapsed": 5833,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "!wget 'https://raw.githubusercontent.com/zaidalyafeai/zaidalyafeai.github.io/master/sketcher/mini_classes.txt'"
      ],
      "execution_count": 1,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "--2018-07-03 18:55:10--  https://raw.githubusercontent.com/zaidalyafeai/zaidalyafeai.github.io/master/sketcher/mini_classes.txt\n",
            "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...\n",
            "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 760 [text/plain]\n",
            "Saving to: ‘mini_classes.txt.3’\n",
            "\n",
            "mini_classes.txt.3  100%[===================>]     760  --.-KB/s    in 0s      \n",
            "\n",
            "2018-07-03 18:55:10 (74.2 MB/s) - ‘mini_classes.txt.3’ saved [760/760]\n",
            "\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "id": "4GL_TdMffD6-",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "Read the classes names "
      ]
    },
    {
      "metadata": {
        "id": "eP-OxOx5sy0b",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "f = open(\"mini_classes.txt\",\"r\")\n",
        "# And for reading use\n",
        "classes = f.readlines()\n",
        "f.close()"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "lTE6D3uxtMc5",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "classes = [c.replace('\\n','').replace(' ','_') for c in classes]"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "5NDfBHVjACAt",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Download the Dataset "
      ]
    },
    {
      "metadata": {
        "id": "7MC_PUS-fKjH",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "Loop over the classes and download the currospondent data"
      ]
    },
    {
      "metadata": {
        "id": "rdSUnpL0u22Q",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "!mkdir data"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "22DPhL5FtWcQ",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "import urllib.request\n",
        "def download():\n",
        "  \n",
        "  base = 'https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/'\n",
        "  for c in classes:\n",
        "    cls_url = c.replace('_', '%20')\n",
        "    path = base+cls_url+'.npy'\n",
        "    print(path)\n",
        "    urllib.request.urlretrieve(path, 'data/'+c+'.npy')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "O5jF6TXXu-Bu",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 1754
        },
        "outputId": "865b0cb8-46a4-4ead-f644-488b00c7d89d",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1530643608808,
          "user_tz": -180,
          "elapsed": 112624,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "download() "
      ],
      "execution_count": 6,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/drums.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/sun.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/laptop.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/anvil.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/baseball%20bat.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/ladder.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/eyeglasses.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/grapes.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/book.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/dumbbell.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/traffic%20light.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/wristwatch.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/wheel.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/shovel.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/bread.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/table.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/tennis%20racquet.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/cloud.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/chair.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/headphones.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/face.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/eye.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/airplane.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/snake.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/lollipop.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/power%20outlet.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/pants.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/mushroom.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/star.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/sword.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/clock.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/hot%20dog.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/syringe.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/stop%20sign.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/mountain.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/smiley%20face.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/apple.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/bed.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/shorts.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/broom.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/diving%20board.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/flower.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/spider.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/cell%20phone.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/car.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/camera.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/tree.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/square.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/moon.npy\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "stream",
          "text": [
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/radio.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/hat.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/pizza.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/axe.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/door.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/tent.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/umbrella.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/line.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/cup.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/fan.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/triangle.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/basketball.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/pillow.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/scissors.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/t-shirt.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/tooth.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/alarm%20clock.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/paper%20clip.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/spoon.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/microphone.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/candle.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/pencil.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/envelope.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/saw.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/frying%20pan.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/screwdriver.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/helmet.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/bridge.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/light%20bulb.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/ceiling%20fan.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/key.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/donut.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/bird.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/circle.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/beard.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/coffee%20cup.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/butterfly.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/bench.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/rifle.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/cat.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/sock.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/ice%20cream.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/moustache.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/suitcase.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/hammer.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/rainbow.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/knife.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/cookie.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/baseball.npy\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "stream",
          "text": [
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/lightning.npy\n",
            "https://storage.googleapis.com/quickdraw_dataset/full/numpy_bitmap/bicycle.npy\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "id": "uEdnbBVXAI-X",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Imports "
      ]
    },
    {
      "metadata": {
        "id": "J2FYrPgOKh6t",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "import os\n",
        "import glob\n",
        "import numpy as np\n",
        "from tensorflow.keras import layers\n",
        "from tensorflow import keras \n",
        "import tensorflow as tf"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "6o30ipBPAQ5Y",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Load the Data "
      ]
    },
    {
      "metadata": {
        "id": "UBq3GXEKAYuO",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "Each class contains different number samples of arrays stored as .npy format. Since we have some memory limitations we only load 5000 images per class.  "
      ]
    },
    {
      "metadata": {
        "id": "6HEIgQNHYQnl",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "def load_data(root, vfold_ratio=0.2, max_items_per_class= 4000 ):\n",
        "    all_files = glob.glob(os.path.join(root, '*.npy'))\n",
        "\n",
        "    #initialize variables \n",
        "    x = np.empty([0, 784])\n",
        "    y = np.empty([0])\n",
        "    class_names = []\n",
        "\n",
        "    #load each data file \n",
        "    for idx, file in enumerate(all_files):\n",
        "        data = np.load(file)\n",
        "        data = data[0: max_items_per_class, :]\n",
        "        labels = np.full(data.shape[0], idx)\n",
        "\n",
        "        x = np.concatenate((x, data), axis=0)\n",
        "        y = np.append(y, labels)\n",
        "\n",
        "        class_name, ext = os.path.splitext(os.path.basename(file))\n",
        "        class_names.append(class_name)\n",
        "\n",
        "    data = None\n",
        "    labels = None\n",
        "    \n",
        "    #randomize the dataset \n",
        "    permutation = np.random.permutation(y.shape[0])\n",
        "    x = x[permutation, :]\n",
        "    y = y[permutation]\n",
        "\n",
        "    #separate into training and testing \n",
        "    vfold_size = int(x.shape[0]/100*(vfold_ratio*100))\n",
        "\n",
        "    x_test = x[0:vfold_size, :]\n",
        "    y_test = y[0:vfold_size]\n",
        "\n",
        "    x_train = x[vfold_size:x.shape[0], :]\n",
        "    y_train = y[vfold_size:y.shape[0]]\n",
        "    return x_train, y_train, x_test, y_test, class_names"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "K6uUjN-WL2Y9",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "x_train, y_train, x_test, y_test, class_names = load_data('data')\n",
        "num_classes = len(class_names)\n",
        "image_size = 28"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "VhGEDS0SMgLK",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "dee69abc-1ae5-4d32-be7e-74ab81a3d535",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1530643829213,
          "user_tz": -180,
          "elapsed": 643,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "print(len(x_train))"
      ],
      "execution_count": 7,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "400000\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "id": "rNZmQvBWBBHE",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "Show some random data "
      ]
    },
    {
      "metadata": {
        "id": "KfpDaHRkyMQC",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 282
        },
        "outputId": "0f070893-98d5-42fa-b77d-f0a1d57210f7",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1530643832178,
          "user_tz": -180,
          "elapsed": 1059,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "import matplotlib.pyplot as plt\n",
        "from random import randint\n",
        "%matplotlib inline  \n",
        "idx = randint(0, len(x_train))\n",
        "plt.imshow(x_train[idx].reshape(28,28)) \n",
        "print(class_names[int(y_train[idx].item())])"
      ],
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "shovel\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD4CAYAAADFJPs2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAD4ZJREFUeJzt3XuMVeW5x/EvglrA2ipNnQOpVj3D\nE49ijIbQIQcKp3L0gB7+8FITJIgETkCqwRhDY2JQE1sVwlHARuMFxHhDY8FWpVQNYJBIjBdazaM0\nBBNQR0GKeJnjwJw/ZjPuPc5692bPvg3P7/PXetcz79pvlv7Y67LXevt1dHQgIke2o+o9ABGpPgVd\nJAAFXSQABV0kAAVdJIABNfocXdoXqb5+WYWyg25mi4Ff0Bni69x9S7nbEpHqKuvQ3cx+CTS7ewsw\nA7inoqMSkYoq9xz9V8AfAdz9PeA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a6u6/qd+IwMzOAlYDi919qZn9jM7psPoDHwFT3b2tQca2nAaZSruH\nab630AD7rZ7Tj9c06Gb2S6A5NwXzGcBDQEstx1DEene/tN6DADCzwcASCqe/uhVY5u6rzOx24Grq\nMB1WxtigAabSzpjm+yXqvN/qPf14rQ/dfwX8EcDd3wNOMLPjazyGvqINmAjsyls3js657gCeA86v\n8ZgO6WlsjWIDcFlu+dA03+Oo/37raVw1m3681ofuTcAbee1Pc+v21XgcWf7NzNYAJwK3uPu6eg3E\n3duB9rxpsAAG5x1ytgL/UvOBkTk2gLlmdj2lTaVdrbEdAL7MNWcAzwMX1Hu/ZYzrADXaZ/W+GNdI\nv4H/ALgFmAxMAx40s2PqO6SkRtp30GBTaXeb5jtfXfdbvaYfr/U3+i46v8EPGUrnxZG6c/edwJO5\n5j/M7GNgGLC9fqP6nv1mNtDdv6ZzbA1z6OzuDTOVdvdpvs2sIfZbPacfr/U3+l+ASwHM7Fxgl7t/\nUeMx9MjMppjZDbnlJuAkYGd9R/U9fwUuyS1fArxYx7EUaJSptHua5psG2G/1nn68VrOpdjGz3wNj\ngYPANe7+dk0HkMHMfgg8BvwYOIbOc/Tn6zie84BFwM+Bb+n8R2cKsBz4AbADmO7u3zbI2JYA84Gu\nqbTdvbUOY5tF5yHw+3mrpwEPUMf9ljGuh+k8hK/6Pqt50EWk9up9MU5EakBBFwlAQRcJQEEXCUBB\nFwlAQRcJQEEXCeD/Aa0wYX92XjAlAAAAAElFTkSuQmCC\n",
            "text/plain": [
              "<matplotlib.figure.Figure at 0x7f359ad8af98>"
            ]
          },
          "metadata": {
            "tags": []
          }
        }
      ]
    },
    {
      "metadata": {
        "id": "n8InHz5NBFrV",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Preprocess the Data "
      ]
    },
    {
      "metadata": {
        "id": "p2GHUq7D2r9e",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "# Reshape and normalize\n",
        "x_train = x_train.reshape(x_train.shape[0], image_size, image_size, 1).astype('float32')\n",
        "x_test = x_test.reshape(x_test.shape[0], image_size, image_size, 1).astype('float32')\n",
        "\n",
        "x_train /= 255.0\n",
        "x_test /= 255.0\n",
        "\n",
        "# Convert class vectors to class matrices\n",
        "y_train = keras.utils.to_categorical(y_train, num_classes)\n",
        "y_test = keras.utils.to_categorical(y_test, num_classes)"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "rL6XAb4hBMSc",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# The Model "
      ]
    },
    {
      "metadata": {
        "id": "uYUVV2wf2z8H",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 469
        },
        "outputId": "521cf96e-3039-411e-d14e-5aaca559b518",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1530644647570,
          "user_tz": -180,
          "elapsed": 715,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "# Define model\n",
        "model = keras.Sequential()\n",
        "model.add(layers.Convolution2D(16, (3, 3),\n",
        "                        padding='same',\n",
        "                        input_shape=x_train.shape[1:], activation='relu'))\n",
        "model.add(layers.MaxPooling2D(pool_size=(2, 2)))\n",
        "model.add(layers.Convolution2D(32, (3, 3), padding='same', activation= 'relu'))\n",
        "model.add(layers.MaxPooling2D(pool_size=(2, 2)))\n",
        "model.add(layers.Convolution2D(64, (3, 3), padding='same', activation= 'relu'))\n",
        "model.add(layers.MaxPooling2D(pool_size =(2,2)))\n",
        "model.add(layers.Flatten())\n",
        "model.add(layers.Dense(128, activation='relu'))\n",
        "model.add(layers.Dense(100, activation='softmax')) \n",
        "# Train model\n",
        "adam = tf.train.AdamOptimizer()\n",
        "model.compile(loss='categorical_crossentropy',\n",
        "              optimizer=adam,\n",
        "              metrics=['top_k_categorical_accuracy'])\n",
        "print(model.summary())"
      ],
      "execution_count": 16,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "_________________________________________________________________\n",
            "Layer (type)                 Output Shape              Param #   \n",
            "=================================================================\n",
            "conv2d_9 (Conv2D)            (None, 28, 28, 16)        160       \n",
            "_________________________________________________________________\n",
            "max_pooling2d_9 (MaxPooling2 (None, 14, 14, 16)        0         \n",
            "_________________________________________________________________\n",
            "conv2d_10 (Conv2D)           (None, 14, 14, 32)        4640      \n",
            "_________________________________________________________________\n",
            "max_pooling2d_10 (MaxPooling (None, 7, 7, 32)          0         \n",
            "_________________________________________________________________\n",
            "conv2d_11 (Conv2D)           (None, 7, 7, 64)          18496     \n",
            "_________________________________________________________________\n",
            "max_pooling2d_11 (MaxPooling (None, 3, 3, 64)          0         \n",
            "_________________________________________________________________\n",
            "flatten_3 (Flatten)          (None, 576)               0         \n",
            "_________________________________________________________________\n",
            "dense_6 (Dense)              (None, 128)               73856     \n",
            "_________________________________________________________________\n",
            "dense_7 (Dense)              (None, 100)               12900     \n",
            "=================================================================\n",
            "Total params: 110,052\n",
            "Trainable params: 110,052\n",
            "Non-trainable params: 0\n",
            "_________________________________________________________________\n",
            "None\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "id": "_YRSRkOyBP1P",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Training "
      ]
    },
    {
      "metadata": {
        "id": "7OMEJ7kF3lsP",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 225
        },
        "outputId": "4d9a46ad-2ed1-4b4f-c1ec-687997025034",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1530644959352,
          "user_tz": -180,
          "elapsed": 67011,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "model.fit(x = x_train, y = y_train, validation_split=0.1, batch_size = 256, verbose=2, epochs=5)"
      ],
      "execution_count": 17,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Train on 288000 samples, validate on 32000 samples\n",
            "Epoch 1/5\n",
            " - 14s - loss: 1.8775 - top_k_categorical_accuracy: 0.7930 - val_loss: 1.3543 - val_top_k_categorical_accuracy: 0.8811\n",
            "Epoch 2/5\n",
            " - 13s - loss: 1.2097 - top_k_categorical_accuracy: 0.8960 - val_loss: 1.1262 - val_top_k_categorical_accuracy: 0.9063\n",
            "Epoch 3/5\n",
            " - 13s - loss: 1.0523 - top_k_categorical_accuracy: 0.9132 - val_loss: 1.0283 - val_top_k_categorical_accuracy: 0.9166\n",
            "Epoch 4/5\n",
            " - 13s - loss: 0.9646 - top_k_categorical_accuracy: 0.9220 - val_loss: 0.9908 - val_top_k_categorical_accuracy: 0.9186\n",
            "Epoch 5/5\n",
            " - 13s - loss: 0.9038 - top_k_categorical_accuracy: 0.9282 - val_loss: 0.9460 - val_top_k_categorical_accuracy: 0.9235\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/plain": [
              "<tensorflow.python.keras.callbacks.History at 0x7f1a2f22be10>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 17
        }
      ]
    },
    {
      "metadata": {
        "id": "d2KztY7qEn9_",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Testing "
      ]
    },
    {
      "metadata": {
        "id": "ssaZczS7DxeA",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 34
        },
        "outputId": "63f7726d-205e-4cf7-9540-0c3d379e54e4",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1530644983815,
          "user_tz": -180,
          "elapsed": 6353,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "score = model.evaluate(x_test, y_test, verbose=0)\n",
        "print('Test accuarcy: {:0.2f}%'.format(score[1] * 100))"
      ],
      "execution_count": 18,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Test accuarcy: 92.20%\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "id": "9xBM_w0VBbNr",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Inference "
      ]
    },
    {
      "metadata": {
        "id": "nH3JfoiYHdpk",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 282
        },
        "outputId": "ca2ed216-7069-4caf-b72a-784a11da8553",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1530049874624,
          "user_tz": -180,
          "elapsed": 1946,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "import matplotlib.pyplot as plt\n",
        "from random import randint\n",
        "%matplotlib inline  \n",
        "idx = randint(0, len(x_test))\n",
        "img = x_test[idx]\n",
        "plt.imshow(img.squeeze()) \n",
        "pred = model.predict(np.expand_dims(img, axis=0))[0]\n",
        "ind = (-pred).argsort()[:5]\n",
        "latex = [class_names[x] for x in ind]\n",
        "print(latex)"
      ],
      "execution_count": 8,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "['alarm_clock', 'bread', 't-shirt', 'butterfly', 'bird']\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "display_data",
          "data": {
            "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPoAAAD4CAYAAADFJPs2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAEt5JREFUeJzt3XmMVlWax/EvoggUJYIiJUhaaPGA\nccEFFVAEwZVxCIHORIEgEBwXtM3ExDUGMdItLozbkBidARlRGjSCNiqLYyMKikSQbuEIWgJSIEsj\nAg1VCDV/1Ev1e6vee+7Le9+t6vw+//R7zlPn1tNv8XiXc+89TaqrqxGRxu24QicgIrmnQhfxgApd\nxAMqdBEPqNBFPHB8nn6PLu2L5F6TsEDGhW6MmQJcTk0R/95auyLTbYlIbmV06G6MuQroaq3tBYwF\nns9qViKSVZmeow8A3gGw1q4F2hhjTspaViKSVZkWehmwI6m9I9EnIkUoW1fdQy8CiEjhZVroFQT3\n4B2ArfHTEZFcyLTQFwDDAIwxFwEV1tq9WctKRLKqSaZPrxlj/gj0BY4Ad1lrVzt+vGjn0ffuDf73\nqbS0NND35Zdfho49cOBArN/ds2dPZ7xdu3axti/eyf48urX2gUzHikh+6RZYEQ+o0EU8oEIX8YAK\nXcQDKnQRD6jQRTyQ8Tz6McrZL9m8ebMzfueddzrj8+fPD7QPHz5M06ZNa9tHjhzJPLkIvXv3dsY/\n/fTTnP1uaZRC59G1RxfxgApdxAMqdBEPqNBFPKBCF/GACl3EA/l63XMs+/fvD4317dvXOTZ5qiyV\n1157zdl3ww03hI5t2bKlc9tvvvmmMz569Ghn/ODBg4F28+bNA33Nmzd3jpf66n6ndR13nHvf16xZ\ns2ymkzfao4t4QIUu4gEVuogHVOgiHlChi3hAhS7i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q\nAzUXRwrOWrsFmJVofmeM2QZ0BMrDR+XdPmNMC2vtAWpyK5pDZ2tt0SylXXeZb2NMUXxvhVx+PN97\n9AXAMABjzEVAhbV2b55zSMkYM9wYc1/icxnQHthS2KzqWQQMTXweCnxQwFwCimUp7VTLfFME31uh\nlx/P1+ueaxlj/gj0BY4Ad1lrw9f+zSNjTCkwEzgZaEbNOfr8AuZzMfAMcCZwiJr/6AwHpgHNgY3U\nLFd9qEhyewF4gPSX0s5VbqmW+R4FvEIBv7csLT+esbwXuojkX6EvxolIHqjQRTygQhfxgApdxAMq\ndBEPqNBFPKBCF/HA/wNSuG+7tunptgAAAABJRU5ErkJggg==\n",
            "text/plain": [
              "<matplotlib.figure.Figure at 0x7fe3c10abc88>"
            ]
          },
          "metadata": {
            "tags": []
          }
        }
      ]
    },
    {
      "metadata": {
        "id": "YPp5D82YBhM-",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Store the classes "
      ]
    },
    {
      "metadata": {
        "id": "NoFI1msFYpCN",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "with open('class_names.txt', 'w') as file_handler:\n",
        "    for item in class_names:\n",
        "        file_handler.write(\"{}\\n\".format(item))"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "mfJ6dpaDBpRx",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Install TensorFlowJS"
      ]
    },
    {
      "metadata": {
        "id": "hJJDfp9mY9Xh",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 877
        },
        "outputId": "5f1b0500-99ca-4935-89da-d2359bb5c29b",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1529231719677,
          "user_tz": -180,
          "elapsed": 12261,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "!pip install tensorflowjs "
      ],
      "execution_count": 10,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Collecting tensorflowjs\n",
            "  Downloading https://files.pythonhosted.org/packages/b2/fd/39f5e1709a543cdce74f2ff6423d70800dbb785494ff66765464feeb67a5/tensorflowjs-0.4.1-py3-none-any.whl\n",
            "Requirement already satisfied: tensorflow==1.8.0 in /usr/local/lib/python3.6/dist-packages (from tensorflowjs) (1.8.0)\n",
            "Requirement already satisfied: six==1.11.0 in /usr/local/lib/python3.6/dist-packages (from tensorflowjs) (1.11.0)\n",
            "Collecting keras==2.1.4 (from tensorflowjs)\n",
            "\u001b[?25l  Downloading https://files.pythonhosted.org/packages/86/45/a273fe3f8fe931a11da34fba1cb74013cfc70dcf93e5d8d329c951dc44c5/Keras-2.1.4-py2.py3-none-any.whl (322kB)\n",
            "\u001b[K    100% |████████████████████████████████| 327kB 6.4MB/s \n",
            "\u001b[?25hRequirement already satisfied: h5py==2.7.1 in /usr/local/lib/python3.6/dist-packages (from tensorflowjs) (2.7.1)\n",
            "Collecting numpy==1.14.1 (from tensorflowjs)\n",
            "\u001b[?25l  Downloading https://files.pythonhosted.org/packages/de/7d/348c5d8d44443656e76285aa97b828b6dbd9c10e5b9c0f7f98eff0ff70e4/numpy-1.14.1-cp36-cp36m-manylinux1_x86_64.whl (12.2MB)\n",
            "\u001b[K    100% |████████████████████████████████| 12.2MB 3.5MB/s \n",
            "\u001b[?25hRequirement already satisfied: tensorflow-hub==0.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflowjs) (0.1.0)\n",
            "Requirement already satisfied: astor>=0.6.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.8.0->tensorflowjs) (0.6.2)\n",
            "Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.8.0->tensorflowjs) (1.1.0)\n",
            "Requirement already satisfied: protobuf>=3.4.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.8.0->tensorflowjs) (3.5.2.post1)\n",
            "Requirement already satisfied: absl-py>=0.1.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.8.0->tensorflowjs) (0.2.2)\n",
            "Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.8.0->tensorflowjs) (1.12.1)\n",
            "Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.8.0->tensorflowjs) (0.31.1)\n",
            "Requirement already satisfied: gast>=0.2.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.8.0->tensorflowjs) (0.2.0)\n",
            "Requirement already satisfied: tensorboard<1.9.0,>=1.8.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow==1.8.0->tensorflowjs) (1.8.0)\n",
            "Requirement already satisfied: scipy>=0.14 in /usr/local/lib/python3.6/dist-packages (from keras==2.1.4->tensorflowjs) (0.19.1)\n",
            "Requirement already satisfied: pyyaml in /usr/local/lib/python3.6/dist-packages (from keras==2.1.4->tensorflowjs) (3.12)\n",
            "Requirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from protobuf>=3.4.0->tensorflow==1.8.0->tensorflowjs) (39.2.0)\n",
            "Requirement already satisfied: bleach==1.5.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->tensorflowjs) (1.5.0)\n",
            "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.6/dist-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->tensorflowjs) (2.6.11)\n",
            "Requirement already satisfied: werkzeug>=0.11.10 in /usr/local/lib/python3.6/dist-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->tensorflowjs) (0.14.1)\n",
            "Requirement already satisfied: html5lib==0.9999999 in /usr/local/lib/python3.6/dist-packages (from tensorboard<1.9.0,>=1.8.0->tensorflow==1.8.0->tensorflowjs) (0.9999999)\n",
            "Installing collected packages: numpy, keras, tensorflowjs\n",
            "  Found existing installation: numpy 1.14.3\n",
            "    Uninstalling numpy-1.14.3:\n",
            "      Successfully uninstalled numpy-1.14.3\n",
            "  Found existing installation: Keras 2.1.6\n",
            "    Uninstalling Keras-2.1.6:\n",
            "      Successfully uninstalled Keras-2.1.6\n",
            "Successfully installed keras-2.1.4 numpy-1.14.1 tensorflowjs-0.4.1\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "id": "-oBl0ZKVB00d",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Save and Convert "
      ]
    },
    {
      "metadata": {
        "id": "XVICB3TbZGb2",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "model.save('keras.h5')"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "bTWWlGdWZOvs",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 133
        },
        "outputId": "98724960-128d-4ecc-cdb0-460f7c06536e",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1529231773802,
          "user_tz": -180,
          "elapsed": 11835,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "!mkdir model\n",
        "!tensorflowjs_converter --input_format keras keras.h5 model/"
      ],
      "execution_count": 13,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "mkdir: cannot create directory ‘model’: File exists\n",
            "/usr/local/lib/python3.6/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
            "  from ._conv import register_converters as _register_converters\n",
            "Using TensorFlow backend.\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "id": "JKYxE2MEB6LV",
        "colab_type": "text"
      },
      "cell_type": "markdown",
      "source": [
        "# Zip and Download "
      ]
    },
    {
      "metadata": {
        "id": "865-t79uaB63",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "!cp class_names.txt model/class_names.txt"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "metadata": {
        "id": "GLC-MzW8ZXTa",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          },
          "base_uri": "https://localhost:8080/",
          "height": 209
        },
        "outputId": "402d4e6c-da44-4815-fe0a-34a90e886e0d",
        "executionInfo": {
          "status": "ok",
          "timestamp": 1529231795307,
          "user_tz": -180,
          "elapsed": 2286,
          "user": {
            "displayName": "zaid Alyafeai",
            "photoUrl": "//lh6.googleusercontent.com/-VBgg2Q0X4wg/AAAAAAAAAAI/AAAAAAAAAyA/nbQguqKrgBE/s50-c-k-no/photo.jpg",
            "userId": "116153592228357722576"
          }
        }
      },
      "cell_type": "code",
      "source": [
        "!zip -r model.zip model "
      ],
      "execution_count": 15,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "  adding: model/ (stored 0%)\r\n",
            "  adding: model/group5-shard1of1 (deflated 7%)\r\n",
            "  adding: model/model.json (deflated 82%)\r\n",
            "  adding: model/group2-shard1of1 (deflated 7%)\r\n",
            "  adding: model/group3-shard1of1 (deflated 7%)\r\n",
            "  adding: model/class_names.txt (deflated 41%)\r\n",
            "  adding: model/group1-shard1of1 (stored 0%)\n",
            "  adding: model/group4-shard1of1 (deflated 7%)\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "metadata": {
        "id": "4vfPR03xZZeD",
        "colab_type": "code",
        "colab": {
          "autoexec": {
            "startup": false,
            "wait_interval": 0
          }
        }
      },
      "cell_type": "code",
      "source": [
        "from google.colab import files\n",
        "files.download('model.zip')"
      ],
      "execution_count": 0,
      "outputs": []
    }
  ]
}
